<?php

namespace Wilead\IArtistBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use JMS\Serializer\Annotation as JMS;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * User
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Wilead\IArtistBundle\Repository\UserRepository")
 * @JMS\ExclusionPolicy("all")
 * @UniqueEntity("mobile")
 */
class User
{

    const ACCOUNT_TYPE_ARTIST = 'artist';
    const ACCOUNT_TYPE_ORGANIZATION = 'organization';
    const SEX_MELE = 'm';
    const SEX_FEMALE = 'f';

    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     * @JMS\Expose
     */
    private $id;

    /**
     * @ORM\Column(type="integer", nullable=true, unique=true)
     * @JMS\Expose
     */
    private $systemNum;

    /**
     * @ORM\Column(type="string", length=11)
     * @JMS\Expose
     * @Assert\NotBlank()
     * @Assert\Regex(
     *     pattern="/\d{11}/",
     *     match=true,
     *     message="Your name cannot contain a number"
     * )
     */
    private $mobile;

    /**
     * @ORM\Column(type="string", length=32)
     * @Assert\NotBlank()
     */
    private $password;

    /**
     * @ORM\Column(type="string", length=6, nullable=true)
     * @JMS\Expose
     */
    private $verificationCode;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     * @JMS\Expose
     */
    private $verificationCodeAt;

    /**
     * @ORM\Column(type="string", nullable=true)
     * @JMS\Expose
     */
    private $signature;

    /**
     * @ORM\Column(type="string")
     * @JMS\Expose
     */
    private $nickname;

    /**
     * @ORM\Column(type="string", length=1, options={"default" = "#"})
     * @JMS\Expose
     */
    private $firstWord;

    /**
     * @ORM\Column(type="string", nullable=true)
     * @JMS\Expose
     */
    private $location;

    /**
     * @ORM\Column(type="string", length=1, nullable=true)
     * @JMS\Expose
     */
    private $sex = self::SEX_MELE;

    /**
     * @ORM\Column(type="integer", nullable=true)
     * @JMS\Expose
     */
    private $age;

    /**
     * @ORM\Column(type="string", length=50, options={"default" = "artist"})
     * @JMS\Expose
     */
    private $accountType = self::ACCOUNT_TYPE_ARTIST;

    /**
     * @ORM\Column(type="boolean", options={"default" = 0})
     * @JMS\Expose
     */
    private $isMember = FALSE;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     * @JMS\Expose
     */
    private $memberExpiredAt;

    /**
     * @ORM\Column(type="string", nullable=true)
     * @JMS\Expose
     */
    private $avatar;

    /**
     * @ORM\Column(type="boolean", options={"default" = 0})
     * @JMS\Expose
     */
    protected $friendVerification = FALSE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $searchAble = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $albumsViewAll = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $albumsViewFriend = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $albumsViewOrganization = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $videoViewAll = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $videoViewFriend = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $videoViewOrganization = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $resumeViewAll = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $resumeViewFriend = TRUE;

    /**
     * @ORM\Column(type="boolean", options={"default" = 1})
     * @JMS\Expose
     */
    protected $resumeViewOrganization = TRUE;

    /**
     * @ORM\Column(type="point", nullable=true)
     * @JMS\Expose
     */
    private $points;

    /**
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime")
     */
    private $created;

    /**
     * @Gedmo\Timestampable(on="update")
     * @ORM\Column(type="datetime")
     */
    private $updated;

    /**
     * @ORM\OneToOne(targetEntity="UserResume", mappedBy="User")
     * @JMS\Expose
     */
    private $UserResume;

    /**
     * @ORM\OneToOne(targetEntity="UserIntroduction", mappedBy="User")
     * @JMS\Expose
     */
    private $UserIntroduction;

    /**
     * @ORM\ManyToMany(targetEntity="User", mappedBy="Friends")
     * */
    private $FriendsWithMe;

    /**
     * @ORM\ManyToMany(targetEntity="User", inversedBy="FriendsWithMe")
     * @ORM\JoinTable(
     *      name="UserFriends",
     *      joinColumns={@ORM\JoinColumn(name="userId", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="friendId", referencedColumnName="id")}
     * )
     * */
    private $Friends;

    /**
     * @ORM\OneToMany(targetEntity="UserSkill", mappedBy="User")
     * @JMS\Expose
     * */
    private $UserSkills;

    /**
     * @ORM\OneToMany(targetEntity="Job", mappedBy="User")
     * */
    private $Jobs;

    /**
     * @ORM\OneToMany(targetEntity="UserAlbums", mappedBy="User")
     * @JMS\Expose
     * */
    private $UserAlbums;

    /**
     * @ORM\OneToMany(targetEntity="UserVideo", mappedBy="User")
     * @JMS\Expose
     * */
    private $UserVideos;

    public function __toString()
    {
        return $this->nickname;
    }

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->FriendsWithMe = new \Doctrine\Common\Collections\ArrayCollection();
        $this->Friends = new \Doctrine\Common\Collections\ArrayCollection();
        $this->UserSkills = new \Doctrine\Common\Collections\ArrayCollection();
        $this->Jobs = new \Doctrine\Common\Collections\ArrayCollection();
        $this->UserAlbums = new \Doctrine\Common\Collections\ArrayCollection();
        $this->UserVideos = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set systemNum
     *
     * @param integer $systemNum
     * @return User
     */
    public function setSystemNum($systemNum)
    {
        $this->systemNum = $systemNum;

        return $this;
    }

    /**
     * Get systemNum
     *
     * @return integer
     */
    public function getSystemNum()
    {
        return $this->systemNum;
    }

    /**
     * Set mobile
     *
     * @param string $mobile
     * @return User
     */
    public function setMobile($mobile)
    {
        $this->mobile = $mobile;

        return $this;
    }

    /**
     * Get mobile
     *
     * @return string
     */
    public function getMobile()
    {
        return $this->mobile;
    }

    /**
     * Set password
     *
     * @param string $password
     * @return User
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Get password
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Set verificationCode
     *
     * @param string $verificationCode
     * @return User
     */
    public function setVerificationCode($verificationCode)
    {
        $this->verificationCode = $verificationCode;

        return $this;
    }

    /**
     * Get verificationCode
     *
     * @return string
     */
    public function getVerificationCode()
    {
        return $this->verificationCode;
    }

    /**
     * Set verificationCodeAt
     *
     * @param \DateTime $verificationCodeAt
     * @return User
     */
    public function setVerificationCodeAt($verificationCodeAt)
    {
        $this->verificationCodeAt = $verificationCodeAt;

        return $this;
    }

    /**
     * Get verificationCodeAt
     *
     * @return \DateTime
     */
    public function getVerificationCodeAt()
    {
        return $this->verificationCodeAt;
    }

    /**
     * Set signature
     *
     * @param string $signature
     * @return User
     */
    public function setSignature($signature)
    {
        $this->signature = $signature;

        return $this;
    }

    /**
     * Get signature
     *
     * @return string
     */
    public function getSignature()
    {
        return $this->signature;
    }

    /**
     * Set nickname
     *
     * @param string $nickname
     * @return User
     */
    public function setNickname($nickname)
    {
        $this->nickname = $nickname;

        return $this;
    }

    /**
     * Get nickname
     *
     * @return string
     */
    public function getNickname()
    {
        return $this->nickname;
    }

    /**
     * Set firstWord
     *
     * @param string $firstWord
     * @return User
     */
    public function setFirstWord($firstWord)
    {
        $this->firstWord = $firstWord;

        return $this;
    }

    /**
     * Get firstWord
     *
     * @return string
     */
    public function getFirstWord()
    {
        return $this->firstWord;
    }

    /**
     * Set location
     *
     * @param string $location
     * @return User
     */
    public function setLocation($location)
    {
        $this->location = $location;

        return $this;
    }

    /**
     * Get location
     *
     * @return string
     */
    public function getLocation()
    {
        return $this->location;
    }

    /**
     * Set sex
     *
     * @param string $sex
     * @return User
     */
    public function setSex($sex)
    {
        $this->sex = $sex;

        return $this;
    }

    /**
     * Get sex
     *
     * @return string
     */
    public function getSex()
    {
        return $this->sex;
    }

    /**
     * Set age
     *
     * @param integer $age
     * @return User
     */
    public function setAge($age)
    {
        $this->age = $age;

        return $this;
    }

    /**
     * Get age
     *
     * @return integer
     */
    public function getAge()
    {
        return $this->age;
    }

    /**
     * Set accountType
     *
     * @param string $accountType
     * @return User
     */
    public function setAccountType($accountType)
    {
        $this->accountType = $accountType;

        return $this;
    }

    /**
     * Get accountType
     *
     * @return string
     */
    public function getAccountType()
    {
        return $this->accountType;
    }

    /**
     * Set isMember
     *
     * @param boolean $isMember
     * @return User
     */
    public function setIsMember($isMember)
    {
        $this->isMember = $isMember;

        return $this;
    }

    /**
     * Get isMember
     *
     * @return boolean
     */
    public function getIsMember()
    {
        return $this->isMember;
    }

    /**
     * Set memberExpiredAt
     *
     * @param \DateTime $memberExpiredAt
     * @return User
     */
    public function setMemberExpiredAt($memberExpiredAt)
    {
        $this->memberExpiredAt = $memberExpiredAt;

        return $this;
    }

    /**
     * Get memberExpiredAt
     *
     * @return \DateTime
     */
    public function getMemberExpiredAt()
    {
        return $this->memberExpiredAt;
    }

    /**
     * Set avatar
     *
     * @param string $avatar
     * @return User
     */
    public function setAvatar($avatar)
    {
        $this->avatar = $avatar;

        return $this;
    }

    /**
     * Get avatar
     *
     * @return string
     */
    public function getAvatar()
    {
        return $this->avatar;
    }

    /**
     * Set friendVerification
     *
     * @param boolean $friendVerification
     * @return User
     */
    public function setFriendVerification($friendVerification)
    {
        $this->friendVerification = $friendVerification;

        return $this;
    }

    /**
     * Get friendVerification
     *
     * @return boolean
     */
    public function getFriendVerification()
    {
        return $this->friendVerification;
    }

    /**
     * Set searchAble
     *
     * @param boolean $searchAble
     * @return User
     */
    public function setSearchAble($searchAble)
    {
        $this->searchAble = $searchAble;

        return $this;
    }

    /**
     * Get searchAble
     *
     * @return boolean
     */
    public function getSearchAble()
    {
        return $this->searchAble;
    }

    /**
     * Set albumsViewAll
     *
     * @param boolean $albumsViewAll
     * @return User
     */
    public function setAlbumsViewAll($albumsViewAll)
    {
        $this->albumsViewAll = $albumsViewAll;

        return $this;
    }

    /**
     * Get albumsViewAll
     *
     * @return boolean
     */
    public function getAlbumsViewAll()
    {
        return $this->albumsViewAll;
    }

    /**
     * Set albumsViewFriend
     *
     * @param boolean $albumsViewFriend
     * @return User
     */
    public function setAlbumsViewFriend($albumsViewFriend)
    {
        $this->albumsViewFriend = $albumsViewFriend;

        return $this;
    }

    /**
     * Get albumsViewFriend
     *
     * @return boolean
     */
    public function getAlbumsViewFriend()
    {
        return $this->albumsViewFriend;
    }

    /**
     * Set albumsViewOrganization
     *
     * @param boolean $albumsViewOrganization
     * @return User
     */
    public function setAlbumsViewOrganization($albumsViewOrganization)
    {
        $this->albumsViewOrganization = $albumsViewOrganization;

        return $this;
    }

    /**
     * Get albumsViewOrganization
     *
     * @return boolean
     */
    public function getAlbumsViewOrganization()
    {
        return $this->albumsViewOrganization;
    }

    /**
     * Set videoViewAll
     *
     * @param boolean $videoViewAll
     * @return User
     */
    public function setVideoViewAll($videoViewAll)
    {
        $this->videoViewAll = $videoViewAll;

        return $this;
    }

    /**
     * Get videoViewAll
     *
     * @return boolean
     */
    public function getVideoViewAll()
    {
        return $this->videoViewAll;
    }

    /**
     * Set videoViewFriend
     *
     * @param boolean $videoViewFriend
     * @return User
     */
    public function setVideoViewFriend($videoViewFriend)
    {
        $this->videoViewFriend = $videoViewFriend;

        return $this;
    }

    /**
     * Get videoViewFriend
     *
     * @return boolean
     */
    public function getVideoViewFriend()
    {
        return $this->videoViewFriend;
    }

    /**
     * Set videoViewOrganization
     *
     * @param boolean $videoViewOrganization
     * @return User
     */
    public function setVideoViewOrganization($videoViewOrganization)
    {
        $this->videoViewOrganization = $videoViewOrganization;

        return $this;
    }

    /**
     * Get videoViewOrganization
     *
     * @return boolean
     */
    public function getVideoViewOrganization()
    {
        return $this->videoViewOrganization;
    }

    /**
     * Set resumeViewAll
     *
     * @param boolean $resumeViewAll
     * @return User
     */
    public function setResumeViewAll($resumeViewAll)
    {
        $this->resumeViewAll = $resumeViewAll;

        return $this;
    }

    /**
     * Get resumeViewAll
     *
     * @return boolean
     */
    public function getResumeViewAll()
    {
        return $this->resumeViewAll;
    }

    /**
     * Set resumeViewFriend
     *
     * @param boolean $resumeViewFriend
     * @return User
     */
    public function setResumeViewFriend($resumeViewFriend)
    {
        $this->resumeViewFriend = $resumeViewFriend;

        return $this;
    }

    /**
     * Get resumeViewFriend
     *
     * @return boolean
     */
    public function getResumeViewFriend()
    {
        return $this->resumeViewFriend;
    }

    /**
     * Set resumeViewOrganization
     *
     * @param boolean $resumeViewOrganization
     * @return User
     */
    public function setResumeViewOrganization($resumeViewOrganization)
    {
        $this->resumeViewOrganization = $resumeViewOrganization;

        return $this;
    }

    /**
     * Get resumeViewOrganization
     *
     * @return boolean
     */
    public function getResumeViewOrganization()
    {
        return $this->resumeViewOrganization;
    }

    /**
     * Set created
     *
     * @param \DateTime $created
     * @return User
     */
    public function setCreated($created)
    {
        $this->created = $created;

        return $this;
    }

    /**
     * Get created
     *
     * @return \DateTime
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * Set updated
     *
     * @param \DateTime $updated
     * @return User
     */
    public function setUpdated($updated)
    {
        $this->updated = $updated;

        return $this;
    }

    /**
     * Get updated
     *
     * @return \DateTime
     */
    public function getUpdated()
    {
        return $this->updated;
    }

    /**
     * Set UserResume
     *
     * @param \Wilead\IArtistBundle\Entity\UserResume $userResume
     * @return User
     */
    public function setUserResume(\Wilead\IArtistBundle\Entity\UserResume $userResume = null)
    {
        $this->UserResume = $userResume;

        return $this;
    }

    /**
     * Get UserResume
     *
     * @return \Wilead\IArtistBundle\Entity\UserResume
     */
    public function getUserResume()
    {
        return $this->UserResume;
    }

    /**
     * Set UserIntroduction
     *
     * @param \Wilead\IArtistBundle\Entity\UserIntroduction $userIntroduction
     * @return User
     */
    public function setUserIntroduction(\Wilead\IArtistBundle\Entity\UserIntroduction $userIntroduction = null)
    {
        $this->UserIntroduction = $userIntroduction;

        return $this;
    }

    /**
     * Get UserIntroduction
     *
     * @return \Wilead\IArtistBundle\Entity\UserIntroduction
     */
    public function getUserIntroduction()
    {
        return $this->UserIntroduction;
    }

    /**
     * Add FriendsWithMe
     *
     * @param \Wilead\IArtistBundle\Entity\User $friendsWithMe
     * @return User
     */
    public function addFriendsWithMe(\Wilead\IArtistBundle\Entity\User $friendsWithMe)
    {
        $this->FriendsWithMe[] = $friendsWithMe;

        return $this;
    }

    /**
     * Remove FriendsWithMe
     *
     * @param \Wilead\IArtistBundle\Entity\User $friendsWithMe
     */
    public function removeFriendsWithMe(\Wilead\IArtistBundle\Entity\User $friendsWithMe)
    {
        $this->FriendsWithMe->removeElement($friendsWithMe);
    }

    /**
     * Get FriendsWithMe
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFriendsWithMe()
    {
        return $this->FriendsWithMe;
    }

    /**
     * Add Friends
     *
     * @param \Wilead\IArtistBundle\Entity\User $friends
     * @return User
     */
    public function addFriend(\Wilead\IArtistBundle\Entity\User $friends)
    {
        $this->Friends[] = $friends;

        return $this;
    }

    /**
     * Remove Friends
     *
     * @param \Wilead\IArtistBundle\Entity\User $friends
     */
    public function removeFriend(\Wilead\IArtistBundle\Entity\User $friends)
    {
        $this->Friends->removeElement($friends);
    }

    /**
     * Get Friends
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFriends()
    {
        return $this->Friends;
    }

    /**
     * Add UserSkills
     *
     * @param \Wilead\IArtistBundle\Entity\UserSkill $userSkills
     * @return User
     */
    public function addUserSkill(\Wilead\IArtistBundle\Entity\UserSkill $userSkills)
    {
        $this->UserSkills[] = $userSkills;

        return $this;
    }

    /**
     * Remove UserSkills
     *
     * @param \Wilead\IArtistBundle\Entity\UserSkill $userSkills
     */
    public function removeUserSkill(\Wilead\IArtistBundle\Entity\UserSkill $userSkills)
    {
        $this->UserSkills->removeElement($userSkills);
    }

    /**
     * Get UserSkills
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getUserSkills()
    {
        return $this->UserSkills;
    }

    /**
     * Add Jobs
     *
     * @param \Wilead\IArtistBundle\Entity\Job $jobs
     * @return User
     */
    public function addJob(\Wilead\IArtistBundle\Entity\Job $jobs)
    {
        $this->Jobs[] = $jobs;

        return $this;
    }

    /**
     * Remove Jobs
     *
     * @param \Wilead\IArtistBundle\Entity\Job $jobs
     */
    public function removeJob(\Wilead\IArtistBundle\Entity\Job $jobs)
    {
        $this->Jobs->removeElement($jobs);
    }

    /**
     * Get Jobs
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getJobs()
    {
        return $this->Jobs;
    }

    /**
     * Add UserAlbums
     *
     * @param \Wilead\IArtistBundle\Entity\UserAlbums $userAlbums
     * @return User
     */
    public function addUserAlbum(\Wilead\IArtistBundle\Entity\UserAlbums $userAlbums)
    {
        $this->UserAlbums[] = $userAlbums;

        return $this;
    }

    /**
     * Remove UserAlbums
     *
     * @param \Wilead\IArtistBundle\Entity\UserAlbums $userAlbums
     */
    public function removeUserAlbum(\Wilead\IArtistBundle\Entity\UserAlbums $userAlbums)
    {
        $this->UserAlbums->removeElement($userAlbums);
    }

    /**
     * Get UserAlbums
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getUserAlbums()
    {
        return $this->UserAlbums;
    }

    /**
     * Add UserVideos
     *
     * @param \Wilead\IArtistBundle\Entity\UserVideo $userVideos
     * @return User
     */
    public function addUserVideo(\Wilead\IArtistBundle\Entity\UserVideo $userVideos)
    {
        $this->UserVideos[] = $userVideos;

        return $this;
    }

    /**
     * Remove UserVideos
     *
     * @param \Wilead\IArtistBundle\Entity\UserVideo $userVideos
     */
    public function removeUserVideo(\Wilead\IArtistBundle\Entity\UserVideo $userVideos)
    {
        $this->UserVideos->removeElement($userVideos);
    }

    /**
     * Get UserVideos
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getUserVideos()
    {
        return $this->UserVideos;
    }

    /**
     * Set points
     *
     * @param point $points
     * @return User
     */
    public function setPoints($points)
    {
        $this->points = $points;

        return $this;
    }

    /**
     * Get points
     *
     * @return point
     */
    public function getPoints()
    {
        return $this->points;
    }

}
